home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 36
/
PC Gamer IT CD 36 2-2.iso
/
VIGDEMO
/
data1.cab
/
Assets
/
scripts
/
rocket.e
< prev
next >
Wrap
Text File
|
1998-09-21
|
4KB
|
675 lines
int Initialize(string type)
{
global int state = 0;
global real explodeTime = 4.0;
global int hitValue = 20;
global real gEndTime = 0.0;
global real gSmokeTime = 0.01;
global int gSmokeTrail = 0;
global real gExplodeRadius = 30.0;
global int gContrail = 1;
global int gStartSound = 7;
global int gProgressSound = 18;
global int gEndSound = 27;
global int gStartSoundChannel;
global real gAcceleration = 600.0;
global real gVelocity;
global real gMaxVelocity = 600.0;
global real gLastTime = 0.0;
global real gMass = 2.0;
global int gScorchMark = 1;
Reset("dummy");
return 0;
}
int startsound(string soundname)
{
gStartSound = GetSoundIndex(soundname);
}
int scorchmark(string flag)
{
gScorchMark = Str2Int(flag);
}
int endsound(string soundname)
{
gEndSound = GetSoundIndex(soundname);
}
int progresssound(string soundname)
{
gProgressSound = GetSoundIndex(soundname);
}
int contrail(string str)
{
gContrail = Str2Int(str);
}
int Reset(string dummy)
{
state = 0;
SetElas(thisObject,0.0);
SetStyle(thisObject,3);
SetCollidableProperties(thisObject,0,0);
SetPrivilege(thisObject,1);
gStartSoundChannel = 0;
wakeupTime = -1.0;
return 0;
}
int exploderadius(string str)
{
gExplodeRadius = Str2Real(str);
}
int damage(string str)
{
hitValue = Str2Int(str);
return 0;
}
int Fire(int flag)
{
real time ;
time = GetTime(thisObject);
gContrail = flag;
if (state == 0)
{
state = 2;
SetCollidableProperties(thisObject,0,1);
SetStyle(thisObject,0);
PlaySound(thisObject,gStartSound);
SetOldPos(thisObject);
wakeupTime = time + 0.05;
gLastTime = time;
gEndTime = time + explodeTime;
}
return 0;
}
int Explosion(int param)
{
FireSaveInfo(thisObject,hitValue,0,gMass);
ExplodeFulfill(1);
return 0;
}
int ExplodeFulfill(int dummy)
{
real time ;
time = GetTime(thisObject);
state = 4;
KillEFX(thisObject,gSmokeTrail);
gSmokeTrail = 0;
Explode(thisObject,hitValue,gExplodeRadius,gMass);
LaunchEFX(thisObject,2,0);
if (gStartSoundChannel != 0)
StopSound(thisObject,gStartSoundChannel);
PlaySound(thisObject,gEndSound);
if (gScorchMark == 1)
MakeDecal(thisObject,1,1,"scorchdecal",4.0);
SetCollidableProperties(thisObject,0,0);
SetStyle(thisObject,4);
wakeupTime = time + 1.0;
return 0;
}
int Collidants(string dummy)
{
if (state == 2)
{
Explosion(0);
}
return 0;
}
int TimedEvent(int input)
{
real time;
real timeStep;
real acc;
time = GetTime(thisObject);
if (state == 2)
{
if (time >= gEndTime)
{
wakeupTime = time;
state = 3;
}
else
{
if (gContrail != 0)
{
if (gSmokeTrail == 0)
{
gSmokeTrail = LaunchEFX(thisObject,1,0);
gStartSoundChannel = PlaySound(thisObject,gProgressSound,0,1,1);
SetOldPos(thisObject);
}
else
{
MoveEFX(thisObject,gSmokeTrail,1);
SetOldPos(thisObject);
}
}
gVelocity = GetSpeed(thisObject);
if (gVelocity < gMaxVelocity)
{
timeStep = time - gLastTime;
gLastTime = time;
acc = timeStep * gAcceleration;
gVelocity += acc;
SetVelocity(thisObject,gVelocity);
}
wakeupTime = time + gSmokeTime;
}
}
else if (state == 3)
{
Explosion(0);
}
else if (state == 4)
{
Remove(thisObject,0);
wakeupTime = -1.0;
}
else
wakeupTime = -1.0;
return 0;
}